From 4449acbb82ece37acbf6189e43c3d75240a54052 Mon Sep 17 00:00:00 2001 From: Kristian Rietveld Date: Sun, 23 Aug 2009 22:01:39 +0200 Subject: [PATCH] Remove broken logic in backwards walks in validate_visible_area() In validate_visible_area() it was assumed that gtk_tree_path_prev() would always return the correct path of the preceding node. This is obviously not true. The if-clause has been removed so that we now always use _gtk_tree_view_find_path() to get the path from the tree, node. --- gtk/gtktreeview.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 5933f536a0..3973bb4b25 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -5988,16 +5988,24 @@ validate_visible_area (GtkTreeView *tree_view) while (area_above > 0) { _gtk_rbtree_prev_full (tree, node, &tree, &node); - if (! gtk_tree_path_prev (above_path) && node != NULL) - { - gtk_tree_path_free (above_path); - above_path = _gtk_tree_view_find_path (tree_view, tree, node); - } - gtk_tree_model_get_iter (tree_view->priv->model, &iter, above_path); + + /* Always find the new path in the tree. We cannot just assume + * a gtk_tree_path_prev() is enough here, as there might be children + * in between this node and the previous sibling node. If this + * appears to be a performance hotspot in profiles, we can look into + * intrigate logic for keeping path, node and iter in sync like + * we do for forward walks. (Which will be hard because of the lacking + * iter_prev). + */ if (node == NULL) break; + gtk_tree_path_free (above_path); + above_path = _gtk_tree_view_find_path (tree_view, tree, node); + + gtk_tree_model_get_iter (tree_view->priv->model, &iter, above_path); + if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID) || GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_COLUMN_INVALID)) { -- 2.30.2